using System.Collections;
using System.Collections.Generic;
using QFramework;
using UnityEngine;


namespace ProjectSurvivor
{
    public class Global
    {
        /// <summary>
        /// 经验值
        /// </summary>
        public static BindableProperty<int> Exp = new BindableProperty<int>(0);
        public static BindableProperty<int> Coin = new BindableProperty<int>(0);
        
        public static BindableProperty<int> Level = new BindableProperty<int>(1);

        public static BindableProperty<float> CurrentSeconds = new BindableProperty<float>(0);
        
        public static BindableProperty<float> SimpleAbilityDamage = new BindableProperty<float>(1);
        public static BindableProperty<float> SimpleAbilityDuration = new BindableProperty<float>(1.5f);

        
        public static BindableProperty<float> ExpPercent = new BindableProperty<float>(0.3f);
        public static BindableProperty<float> CoinPercent = new BindableProperty<float>(0.05f);
        
        

        public static void ResetData()
        {
            Time.timeScale = 1;
            Exp.Value = 0;
            Level.Value = 1;
            CurrentSeconds.Value = 0;
            SimpleAbilityDamage.Value = 1;
            SimpleAbilityDuration.Value = 1.5f;

            EnemyGenerator.EnemyCount.Value = 0;
        }

        public static int ExpToNextLevel()
        {
            return Level.Value * 5;
        }

        public static void GeneratePowerUp(GameObject gameObject)
        {
            //90% 掉落经验值
            var random = Random.Range(0, 100.0f);

            if (random <= 90)
            {
                //掉落经验值;

                PowerUpManager.Default.Exp.Instantiate()
                    .Position(gameObject.transform.position)
                    .Show();
            }
            else
            {
                PowerUpManager.Default.Coin.Instantiate()
                    .Position(gameObject.transform.position)
                    .Show();
            }
        }
        
    }
}

